setwd("C:/Zkristel 1jan2010/Courses/Courses Liege My Own/Class Liege 2009-2010/Genetic Epi 2010/Public Health Epi/Final Version of the Chapters/cursusdata2010") #ped file with header pedigree2.ped <- read.table(file="pedigree2.ped",header=FALSE,sep=" ") nr.of.allele.columns <- length(names(pedigree2.ped[,7:ncol(pedigree2.ped)])) marker.nrs <- 1: (nr.of.allele.columns /2) names <- paste("SNP",sort(rep(marker.nrs,2)),c("a","b"),sep="") names(pedigree2.ped) <- c("PID","ID","FID","MID","sex","status",names) write.table(pedigree2.ped,file="pedigree.ped",col.names=TRUE,row.names=FALSE,sep=" ",quote=FALSE) #phe file with header pedigree.phe <- read.table(file="pheno.dat",header=TRUE, sep=" ") #when interested in function within the genetics package library(genetics) SNP <- read.table("pedigree.ped",header=TRUE)[,7:2006] colcounter <- paste(seq(1,ncol(SNP)-1,2), seq(2,ncol(SNP),2),sep=":") write.table(t(colcounter),"convertlistentries.txt",sep=",",col.names=F,row.names=F,quote=FALSE) #open the file "convertlistentries.txt" and copy the line to be included # in the list() statement below SNP.subset1 <- makeHaplotypes(SNP, convert=list(1:2,3:4,5:6,7:8,9:10,11:12)) SNP.subset1[1,1:10] is.data.frame(SNP.subset1)